<?php /*a:2:{s:67:"D:\phpstudy_pro\WWW\xiaomu\tp\app\admin\view\web\webadmin\edit.html";i:1724492361;s:56:"D:\phpstudy_pro\WWW\xiaomu\tp\app\admin\view\layout.html";i:1725115306;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>欢迎使用小木CMS内容管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link rel="stylesheet" href="/zhcms/layui_v2_9_10/css/layui.css" media="all">
    <link rel="stylesheet" href="/zhcms/style.css?v=<?php echo time();?>" media="all">

    <script src="/zhcms/jquery/jquery-3.6.0.min.js" charset="utf-8"></script>
    <script src="/zhcms/layui_v2_9_10/layui.js" charset="utf-8"></script>

</head>
<body>
<style>
    .required-tip{
        display: inline-block;
        color:#f00505;
        margin-left: 5px;
        font-size: 20px;
        padding-top: 5px;
    }
</style>

<div style="padding:20px">
    <form class="layui-form" action="">
        <input type="hidden" name="id" value="<?php echo htmlentities((string) $cate['id']); ?>">
        <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">上传图片</label>
              
              <div class="layui-input-inline layui-input-wrap">

                <img src="/static/images/upload.png" width="160" height="160" />

                <!-- <input type="tel" name="phone" lay-verify="required|phone" autocomplete="off" lay-reqtext="请填写手机号" lay-affix="clear" class="layui-input demo-phone">
               -->
              </div>

              <div class="layui-form-mid" style="padding: 0!important;"> 
                <button type="button" class="layui-btn layui-btn-primary" lay-on="get-vercode">上传图片</button>
              </div>

            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">分类名称<span class="required-tip">*</span></label>
            <div class="layui-input-block">
            <input type="text" name="category_name" lay-verify="required" placeholder="分类名称" autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) $cate['category_name']); ?>" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">分类排序</label>
            <div class="layui-input-block">
                <input type="number" name="sort" value="<?php echo htmlentities((string) $cate['sort']); ?>" placeholder="请输入数字，数字越大越靠前" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">设置链接</label>
          <div class="layui-input-block">
              <input type="text" name="url" value="<?php echo htmlentities((string) $cate['url']); ?>" placeholder="设置分类链接" autocomplete="off" class="layui-input">
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">分类别名</label>
          <div class="layui-input-block">
              <input type="text" name="alias" value="<?php echo htmlentities((string) $cate['alias']); ?>" placeholder="分类别名，模板名称" autocomplete="off" class="layui-input">
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">启用模板</label>
          <div class="layui-input-block">
            <input type="radio" name="tempstatus" value="1" title="是" <?php if($cate['tempstatus'] == 1): ?>checked<?php endif; ?>>
            <input type="radio" name="tempstatus" value="0" title="否" <?php if($cate['tempstatus'] == 0): ?>checked<?php endif; ?>>
          </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否显示</label>
            <div class="layui-input-block">
              <input type="radio" name="isshow" value="1" title="显示" <?php if($cate['isshow'] == 1): ?>checked<?php endif; ?> />
              <input type="radio" name="isshow" value="0" title="隐藏" <?php if($cate['isshow'] == 0): ?>checked<?php endif; ?> />
            </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">SEO标题</label>
          <div class="layui-input-block">
          <input type="text" name="seo_title"  placeholder="分类SEO标题" value="<?php echo htmlentities((string) $cate['seo_title']); ?>" autocomplete="off" class="layui-input" />
          </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">keywords</label>
            <div class="layui-input-block">
            <textarea placeholder="关键词" class="layui-textarea" name="keywords"><?php echo htmlentities((string) $cate['keywords']); ?></textarea>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">description</label>
            <div class="layui-input-block">
            <textarea placeholder="分类描述" class="layui-textarea" name="descriptions"><?php echo htmlentities((string) $cate['descriptions']); ?></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<script>

layui.use(['form'], function(){
  var form = layui.form;
  var layer = layui.layer;
  var laydate = layui.laydate;
  var util = layui.util;
  
  // 自定义验证规则
  form.verify({
    pass: function(value) {
      if (!/(.+){6,12}$/.test(value)) {
        return '密码必须 6 到 12 位';
      }
    }
  });
  
  // 指定开关事件
  form.on('switch(switchTest)', function(data){
    layer.msg('开关 checked：'+ (this.checked ? 'true' : 'false'), {
      offset: '6px'
    });
    layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是 ON|OFF', data.othis)
  });
  
  // 提交事件
  form.on('submit(demo1)', function(data){
    var field = data.field; // 获取表单字段值
    // 显示填写结果，仅作演示用
    /*
      layer.alert(JSON.stringify(field), {
        title: '当前填写的字段值'
      });
    */
    // 此处可执行 Ajax 等操作

    $.post("<?php echo url('web.webadmin/edit'); ?>",data.field,function(res){

      if(res.code==1){
        layer.msg(res.msg,function(){
          window.parent.refresh()
          //layer.close(window.parent.layerIndex)
        })
      }

      if(res.code==0){
        layer.msg(res.msg)
      }

    })



    // …
    return false; // 阻止默认 form 跳转
  });

});
</script>
 
</body>
</html>